package com.roncoo.permission.service.impl;

import com.roncoo.permission.entity.AdminroleTMenu;
import com.roncoo.permission.dao.AdminroleTMenuMapper;
import com.roncoo.permission.service.IAdminroleTMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yuechuanhao
 * @since 2021-03-29
 */
@Service
public class AdminroleTMenuServiceImpl extends ServiceImpl<AdminroleTMenuMapper, AdminroleTMenu> implements IAdminroleTMenuService {

    @Resource
    private AdminroleTMenuMapper adminroleTMenuMapper;

    @Override
    public List<AdminroleTMenu> menuSon(Integer roleId) {
        return adminroleTMenuMapper.menuSon(roleId);
    }

    @Override
    public List<AdminroleTMenu> menuSon1(Integer roleId) {
        return adminroleTMenuMapper.menuSon1(roleId);
    }

    @Override
    public boolean deleteByroleId(String mid, Integer roleId) {
        boolean a ;
        boolean b = adminroleTMenuMapper.deleteByroleId(roleId);
        String[] mids = mid.split(",");
        for (String i : mids) {
            a = adminroleTMenuMapper.addByroleId(i, roleId);
        }
        if(b=true){
            if(a=true){
                return true;
            }
        }
        return false;
    }
}
